package itheima.com.Demo01.Tesk.Tesk02;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class Test01 {
    public static void main(String[] args) {
        String S = "If you want to change your fate I think you must come to the dark horse to learn java";
        Map<String, Integer> map = new HashMap<>();
        String[] split = S.split(" ");
        for (String s : split) {
            if (map.containsKey(s)) {
                Integer integer = map.get(s);
                integer++;
                map.put(s, integer);
            } else {
                map.put(s, 1);
            }
        }
        map.forEach(
                (String s, Integer ss) -> {
                    System.out.println(s + "---" + ss);
                }
        );

    }
}
